//
//  OwlApplicationDelegate.m
//  Owl
//
//  Created by Tianzhou on 09-1-11.
//  Copyright 2009 Tianzhou Software Inc.. All rights reserved.
//
#define PRINT_RESPONDER_CHAIN_ON_CONSOLE (0)

#import "MethodSwizzle.h"
#import "OwlApplicationDelegate.h"
#import "OwlDocument.h"
#import "OwlPreferenceKeys.h"

@interface NSResponder(NextResponderSwizzle)
- (NSResponder *)myNextResponder;
@end

@implementation NSResponder(NextResponderSwizzle)
- (NSResponder *)myNextResponder
{
	NSLog(@"%@",[self description]);
	if (![self myNextResponder] )
	{
		NSLog(@"\n");
	}
	return [self myNextResponder];
}
@end


@implementation OwlApplicationDelegate

- (void)applicationWillFinishLaunching:(NSNotification *)notification {
	// Most code uses initialize to get the defaults in, but these two classes
	// won't have initialize called until a window gets created, so we force their
	// defaults in now so the prefs and menus will have the right states.
#if PRINT_RESPONDER_CHAIN_ON_CONSOLE
	MethodSwizzle([NSResponder class],@selector(myNextResponder),@selector(nextResponder));
#endif
	[OwlDocument registerDefaults];
}

- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)theApplication {
	return YES;
}

@end
